<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!--返回错误信息-->
<?php echo validation_errors(); ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <?php
    $title = [
        'title' => '招标详情',
    ];
    $this->load->view('/admin/common/header', $title);
    ?>
</head>

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    <!--    头部   侧边菜单-->
    <?php $this->load->view('/admin/common/bodyLeft'); ?>
    <script type="text/javascript">
    	$(".js-sidebar-nav>li:nth-child(12)>ul").show(80);
    	$(".js-sidebar-nav>li:nth-child(12)>a>span").addClass("sidebar-nav-sub-ico-rotate");
    	$(".js-sidebar-nav>li:nth-child(12)>ul>li:nth-child(3)>a").addClass("active");
    </script>
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
			<div class="row-content am-cf">
				<div class="row">
					<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
						<div class="widget am-cf">
							<div class="widget-head am-cf">
								<div class="widget-title  am-cf">
									<ol class="am-breadcrumb am-breadcrumb-slash">
                    <li><a href="/admin/bidding/index?page=1">招投标管理</a></li>
										<li><a href="/admin/bidding/checkList?page=1">招标审核</a></li>
                    <li class="am-active">招标详情</li>
									</ol>
								</div>
							</div>
							<form class="am-form am-text-sm" id="submitForm">
								<div class="widget-body am-fr">
									<div class="tpl-table-black-operation">
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">
											基本信息
										</a>
									</div>

									<div style="margin-top: 20px">
										<div class="am-g">
											<!-- Row start -->
											<div class="am-u-sm-12">
												<div class="am-g-fixed am-cf">
													<div class="am-u-md-6">														
														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="projectid">招标项目编号</label>
																<div class="am-u-md-10">
																	<input name="code" type="text" value="<?php echo $list['code'] ?>" id="projectid" disabled="disabled">
																</div>
																
															</div>
														</div>

														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="name">项目名称</label>
																<div class="am-u-md-10">
																	<input type="text" name="name" value="<?php echo $list['name'] ?>" id="name" disabled="disabled">
																</div>
																
															</div>
														</div>

														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="time">发布时间</label>
																<div class="am-u-md-10">
																	<input type="date" class="am-u-md-10 form-control" value="<?php echo date('Y-m-d',$list['createTime']) ?>" id="time" disabled="disabled">
																</div>
															</div>
														</div>
														
													</div>
													<div class="am-u-md-6">
                                                        <?php
                                                        if($list['needCode']){
                                                            echo '<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="xqdid">需求单号</label>
																<div class="am-u-md-10">
																	<input type="text" name="needCode" value="'.$list['needCode'].'" id="xqdid" disabled="disabled">
																</div>
															</div>
														</div>';
                                                        }else{
                                                            echo '';

                                                        }
                                                        ?>

														<div class="am-form-group">
															<div class="am-g">
																<label class="am-u-md-2 am-md-text-right am-padding-left-0 " for="timelimit">有效时间</label>
																<div class="am-u-sm-10">
																	<input type="tel" name="validTime" value="<?php echo $list['validTime'] ?>" id="timelimit" disabled="disabled">
																</div>
															</div>
														</div>
												    <div class="am-form-group am-form-file">
														<div class="am-g">
													      <label class="am-u-sm-2  am-md-text-right am-padding-left-0 " for="file-2">项目附件</label>
													      <div class="am-inline-block am-u-sm-10">
	                                                          <?php
	                                                          if($list['projectImg']){
	                                                              echo '<a href="'.$list['projectImg'].'" download="项目附件">下载</a>';
	                                                          }else{
	                                                              echo '<a href="javascript:;">未上传</a>';

	                                                          }
	                                                          ?>
													      </div>
												      </div>
												    </div>
													</div>
													<div class="am-form-group  am-u-md-12">
														<div class="am-g">
															<label class="am-u-md-1   am-md-text-right am-padding-left-0 ">所在地区</label>
															<div class="am-u-md-3">
												      			浙江省杭州市滨江区
															</div>
															<div class="am-u-md-8"></div>									
														</div>
													</div>
													
													<div class="am-form-group  am-u-md-12">
														<div class="am-g">
															<label class="am-u-md-2">预选供应商</label>
															<div class="am-u-md-10">																															
																<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
																  <thead>
																	  <tr>
																	    <th>供应商编号</th>
																	    <th>供应商名称</th>
																	    <th>供应商地址</th>
																	  </tr>
																  </thead>
																  <tbody>
                                                                  <?php
                                                                        foreach ($list['supplierInfoAll'] as $k=>$v){
                                                                            echo '<tr>
																  		<td>'.$v['id'].'</td>
																  		<td>'.$v['name'].'</td>
																  		<td>'.$v['address'].'</td>
																  	</tr>';
                                                                        }
                                                                  ?>

																  </tbody>
																</table>																
															</div>
														</div>
													</div>											
													
													<div class="am-form-group  am-u-md-12">
														<div class="am-g">
															<label class="am-u-md-2">项目简介</label>
															<div class="am-u-md-10">
                                                                <?php
                                                                    echo trim($list['synopsis']);
                                                                ?>
															</div>	
														</div>
													</div>														
												</div>
											</div>
										</div>										
									</div>
									<div class="tpl-table-black-operation">
										<hr />
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">其他信息</a>
									</div>
									<br />
									
									<div class="am-form-group am-u-md-12 am-cf">
									    <label for="doc-ipt-3" class="am-u-sm-2 am-form-label">需要的资质</label>
									    <div class="am-u-sm-10">
									      	<div class="am-checkbox">
		                                        <?php
		                                        if($list['needData']){
		                                            echo '<label><input type="checkbox" class="needData-c" value="营业执照" disabled="disabled" checked="checked"/>营业执照</label>';
		                                        }else{
		                                            echo '<label><input type="checkbox" class="needData-c" value="营业执照" disabled="disabled" />营业执照</label>';
		                                        }
		                                        ?>
									      	</div>
									    </div>
								  	</div>
								  
								  <div class="am-form-group  am-u-md-12">
								    <label for="bzmoney" class="am-u-sm-1 am-form-label ">需要交纳保证金</label>
								    <div class="am-u-md-3 am-input-group">
										<input type="number" id="bzmoney" name="needAmount" value="<?php echo $list['needAmount'] ?>" class="am-form-field" disabled="disabled"> 
									  	<span class="am-input-group-label">元</span>
									</div>
									<div class="am-u-md-8"></div>
								  </div>
								  
								  <div class="am-form-group  am-u-md-12">
								    <label for="contacts" class="am-u-sm-1 am-form-label ">联系人</label>
								    <div class="am-u-md-3">
								    	<input type="text"  name="contactMan" value="<?php echo $list['contactMan'] ?>" class="form-control" disabled="disabled">
								    </div>
								    <div class="am-u-md-8"></div>
								  </div>
								  
								  <div class="am-form-group  am-u-md-12">
								    <label for="phone" class="am-u-sm-1 am-form-label ">联系电话</label>
								    <div class="am-u-md-3">
								    	<input type="tel"  name="phone" value="<?php echo $list['phone'] ?>" class="form-control" disabled="disabled">
								    </div>
								    <div class="am-u-md-8"></div>
								  </div>
								  

									
									<div class="tpl-table-black-operation  am-u-md-12">
										<hr />
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">
											文件
										</a>
									</div>
									<br />
									
							    <div class="am-form-group am-form-file am-u-md-12">
							    	<br />
							      <label class="am-u-sm-2 am-form-label " for="file-2">标书文件</label>
									<div class="am-inline-block">
                                        <?php
                                            if($list['biddingFile']){
                                                echo '<a href="'.$list['biddingFile'].'" download="标书文件">下载</a>';
                                            }else{
                                                echo '<a href="javascript:;">未上传</a>';

                                            }
                                        ?>
							      </div>
							    </div>
							    <div class="am-form-group am-form-file am-u-md-12">
							      <label class="am-u-sm-2 am-form-label ">采购清单</label>
							      <div class="am-inline-block">
                                      <?php
                                      if($list['procurementImg']){
                                          echo '<a href="'.$list['procurementImg'].'" download="采购清单">下载</a>';
                                      }else{
                                          echo '<a href="javascript:;">未上传</a>';

                                      }
                                      ?>
                                  </div>
							    </div>
							    
									<div class="tpl-table-black-operation am-u-md-12">
										<hr>
										<a href="javascript:void(0);" class="tpl-table-black-operation-del">供应商资料</a>
									</div>	
									<div class="am-u-md-12 r_box">
								    <p class="am-u-md-12">
								    	预选供应商<span class="r_num"><?php echo count($list['supplierInfo']) ?></span>个&nbsp;&nbsp;&nbsp;&nbsp;
								    	已报名<span class="r_num"><?php echo $list['agree'] ?></span>个&nbsp;&nbsp;&nbsp;&nbsp;
								    	已拒绝<span class="r_num"><?php echo $list['refuse'] ?></span>个
								    </p>
<!--								    <p>资料提交<span class="r_num">3</span>个</p>-->

								  </div>							    
							    <div class=" am-u-md-12 am-g-fixed">
							    	<div class="am-u-sm-6"> 
										<label class="am-u-sm-3 am-form-label" >选择供应商：</label>
										<div class="am-u-sm-9">
											<select data-am-selected class="am-u-sm-8" id="supplier-select">
												<option value=""></option>
	                                            <?php
	                                                foreach ($list['supplierInfoAll'] as $k=>$v){
	                                                    echo '<option value="'.$v['id'].'" >'.$v['name'].'</option>';
	                                                }
	                                            ?>
											</select>
										</div>
										
									</div>
									<div class="am-u-sm-6"> 
										<label class="am-u-sm-3 am-form-label">报价系数：</label>
										<div class="am-u-sm-9">
											<input type="text" readonly="readonly" id="offerNum">
										</div>

									</div>

									<input type="hidden" value="<?php echo $list['id'] ?>" name="id" id="biddingCheckId">

							    </div>
							    <div class="am-g-fixed">
							    	<div class="am-u-sm-12 gys-des">
									    <div class="am-form-group am-form-file am-u-md-12">
									      	<div class="tpl-table-black-operation">
												<br />
												<a href="javascript:void(0);" class="tpl-table-black-operation-del">
													报价单:
												</a>
											</div>
									    </div>
									    <div class="am-form-group am-form-file am-u-md-12">
									    	<label class="am-u-sm-2 am-form-label">报价单：</label>
									    	<div class="am-u-sm-10 bjFile">
<!--									    		<a href="#" id="bjDownload" download="报价单">下载</a>-->
                                               <span>未选择供应商</span>
									    	</div>
									    </div>
									    <div class="am-form-group am-form-file am-u-md-12">
									      	<div class="tpl-table-black-operation">
												<br />
												<a href="javascript:void(0);" class="tpl-table-black-operation-del">
													资质单:
												</a>
											</div>
									    </div>
									    <div class="am-form-group am-form-file am-u-md-12 ">
									    	<label class="am-u-sm-2 am-form-label">营业执照：</label>
									    	<div class="am-u-sm-10 yyzzFile">
									    		<!-- <span>公司营业执照.png</span>  -->
                                                <span>未选择供应商</span>

                                            </div>
									    </div>
									    <div class="am-form-group am-form-file am-u-md-12 ">
									    	<label class="am-u-sm-2 am-form-label">其他资质：</label>
									    	<div class="am-u-sm-10 otherFile">
									    		<!-- <span>公司营业执照.png</span>  -->
                                                <span>未选择供应商</span>

                                            </div>
									    </div>
									    <div class="am-form-group am-form-file am-u-md-12">
									      	<div class="tpl-table-black-operation">
												<br />
												<a href="javascript:void(0);" class="tpl-table-black-operation-del">
													联系信息:
												</a>
											</div>
									    </div>
									    <div class="am-form-group am-form-file am-u-md-12 ">
									    	<div class="am-form-group am-u-md-6">
											    <label for="contactMan" class="am-u-sm-3 am-form-label">联系人：</label>
											    <div class="am-u-sm-9">
											      <input type="text" class="form-control" id="contactMan" readonly="readonly" >
											    </div>
											</div>
											<div class="am-form-group am-u-md-6">
											    <label  class="am-u-sm-3 am-form-label" for="phone">联系电话：</label>
											    <div class="am-u-sm-9">
											      <input type="text" class="form-control" id="phone" readonly="readonly">
											    </div>
											</div>
									    </div>
									    <!-- <div class="am-form-group am-u-md-12 "> -->
                                    <!--         <?php
                                                $format = json_decode($list['checkInfo'],true);

                                                if($format){
                                                    foreach ($format as $k2=>$v2){
                                                        $k2 = $k2+1;
                                                        echo '<div class="am-form-group am-u-md-4 am-u-end">
									    		<label for="pingfen" class="am-u-sm-3 am-form-label">评委'.$k2.':</label>
											    <div class="am-u-sm-9">
											      <input type="text" class="form-control" value="'.$v2['score'].'" id="pingfen" readonly="readonly">
											    </div>
									    	</div>';
                                                    }
                                                }


                                            ?> -->
									    <!-- </div> -->
								    </div>
							    </div>
							    
							    								
									<!--<div class="am-u-sm-12 btn-box">
										<input type="submit" value="暂存" name="action" class="am-btn am-btn-primary tpl-btn-bg-color-success am-u-sm-centered commit" style="width:220px;margin: 20px;">
										<input type="submit" value="提交" name="action" class="am-btn am-btn-primary tpl-btn-bg-color-success am-u-sm-centered commit" style="width:220px;margin: 20px;">
									</div>-->
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>


<script src="/assets/js/amazeui.min.js"></script>
<script src="/assets/js/amazeui.datatables.min.js"></script>
<script src="/assets/js/dataTables.responsive.min.js"></script>
<script src="/assets/js/app.js"></script>
<script type="text/javascript">
	
	$(function() {
		var biddingCheckId = $("#biddingCheckId").val();


		$("#supplier-select").change(function(){
			var supplierId = $(this).val();
			$.ajax({
				url:"/admin/bidding/chooseSupplierFile",
                data:{
                    biddingCheckId:biddingCheckId,
                    supplierId:supplierId
                },
                dataType:"json",
                type:"post",
                async:false,
                success:function(data){
                	console.log(data);
                	var bjFile = data.bjFile;     		//报价单
                	var offerNum = data.offerNum;		//报价系数
                	var contactMan = data.contactMan;	//联系人
                	var phone = data.phone;				//联系电话
                	var yyzzFile = data.yyzzFile;     	//营业执照
                	var otherFile = data.otherFile;  	//其他资质
                	var isRefuse = data.refuseInfo;		//拒绝理由，为null则没拒绝
                	var downloadFile = "";
                	if(isRefuse == null){

                		if(!bjFile){
	                		downloadFile = '<a href="javascript:;">未上传</a>';
	                		$(".bjFile").html(downloadFile);
	                	}else{
	                		downloadFile = '<a href="'+ bjFile +'" download="报价单">下载</a>';
	                		$(".bjFile").html(downloadFile);
	                	}

	                	if(!yyzzFile){
	                		downloadFile = '<a href="javascript:;">未上传</a>';
	                		$(".yyzzFile").html(downloadFile);
	                	}else{
	                		downloadFile = '<a href="'+ yyzzFile +'" download="营业执照">下载</a>';
	                		$(".yyzzFile").html(downloadFile);
	                	}

	                	if(!otherFile){
	                		downloadFile = '<a href="javascript:;">未上传</a>';
	                		$(".otherFile").html(downloadFile);
	                	}else{
	                		downloadFile = '<a href="'+ otherFile +'" download="其他资质">下载</a>';
	                		$(".otherFile").html(downloadFile);
	                	}

	                	$("#offerNum").val(offerNum);
	                	$("#contactMan").val(contactMan);
	                	$("#phone").val(phone);
	                	$(".gys-des").find(".am-form-file").css("display","block");
	                	$(".gys-des").find(".refuse-box").remove();
                	}else{
	                	$("#offerNum").val(offerNum);

                		$(".gys-des").find(".am-form-file").css("display","none");
                		var refuse = "";
                		refuse += '<div class="refuse-box">'
	                		 		+'<div class="am-form-group am-form-file am-u-md-12">'
	                					+'<div class="tpl-table-black-operation">'
	                						+ '<br />'
	                						+ '<a href="javascript:void(0);" class="tpl-table-black-operation-del">该供应商已拒绝</a>'
	                					+ '</div>'
	                				+ '</div>'
	                				+ '<div class="am-form-group am-form-file am-u-md-12">'
		                				+ '<label class="am-u-sm-2 am-form-label">拒绝理由：</label>'
		                				+ '<div class="am-u-sm-10 ">'
		                					+ '<span>'+ isRefuse +'</span>'
		                				+ '</div>'
		                			+ '</div>'
	                			+ '</div>';
	                	$(".gys-des").append(refuse);


                	}
                	
                }
			});
		});
	});
</script>

</body>

</html>